﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title></title>
	<link href="js-console.css" rel="stylesheet" />
	<!-- 1. Write an if statement that examines two integer variables and exchanges
			their values if the first one is greater than the second one. -->
</head>
<body>
	<div id="js-console"></div>
	<script src="js-console.js"></script>
	<script>
		//Read input
		var first = prompt("Enter first number");
		var second = prompt("Enter second number");

		if (!isNaN(first) && !isNaN(second)) {
			first *= 1; second *= 1;	// make them real number

			jsConsole.writeLine("Input numbers are: " + first + " and " + second);

			// Eventual exchange
			if (first > second) {
				var swap = first;
				first = second;
				second = swap;
			}

			// Write result
			jsConsole.writeLine("Output numbers are: " + first + " and " + second);
		}
		else {
			jsConsole.writeLine("Wrong input.");
		}
	</script>
</body>
</html>
